/**
 * 
 */
package pl.koziolekweb.photoarch;

import java.io.File;
import java.util.LinkedList;
import java.util.List;

/**
 * @author koziolek
 * 
 */
public class PhotoArch {

	public void archive() {
		File source = new File("/media/EOS_DIGITAL/DCIM");
		File target = new File("/zdjecia/Photos");
		List<File> photos = getPhotoList(source);
		
	}

	private List<File> getPhotoList(File source) {
		List<File> photos = new LinkedList<File>();
		File[] filesInSource = source.listFiles();
		for (File f : filesInSource) {
			if (f.isDirectory()) {
				photos.addAll(getPhotoList(f));
				continue;
			}
			if (f.getName().toLowerCase().endsWith(".jpg") || f.getName().toLowerCase().endsWith(".cr2")) {
				photos.add(f);
			}
		}
		return photos;
	}
}
